using UnityEngine;
using System.Collections;

public class StateVampAtack : State<VampiroControl>   {

    static StateVampAtack m_instance = new StateVampAtack();
    public static StateVampAtack instance { get { return m_instance; } }
     
    public override void OnEnter(VampiroControl behaviour)
    {
        Debug.Log("VAMPIRO: Empiezo a atacar");
		foreach (AnimationState state in behaviour.animation) {
        	state.speed = 2F;
    	}
		behaviour.animation.Play("Atacar2");
//		behaviour.ProducirDmg();
        behaviour.time = Time.timeSinceLevelLoad;
    }

    public override void OnUpdate(VampiroControl behaviour)
    {
        if ((behaviour.time + behaviour.ATACKSPEED) < Time.timeSinceLevelLoad)
        {
            behaviour.time = Time.timeSinceLevelLoad;
            //behaviour.State = StateVampRun.instance;
        	behaviour.animation.Play("Atacar2");
			behaviour.ProducirDmg();
        }
    }

    public override void OnExit(VampiroControl behaviour)
    {
        Debug.Log("VAMPIRO: Termino de atacar");
    }

    public override void OnAction(string name, VampiroControl behaviour, object value)
    {

    }

}
